home *** CD-ROM | disk | FTP | other *** search
- Path: news.th-darmstadt.de!news!enno
- From: enno@inferenzsysteme.informatik.th-darmstadt.de (Enno Sandner)
- Newsgroups: comp.lang.c++
- Subject: Re: overloading []
- Date: 17 Jan 1996 19:09:00 GMT
- Organization: Fachbereich Informatik, TH Darmstadt
- Distribution: world
- Message-ID: <ENNO.96Jan17200900@kitz.inferenzsysteme.informatik.th-darmstadt.de>
- References: <4dgjbl$6i3@news1.goodnet.com> <4dh86s$bfi@locutus.rchland.ibm.com>
- <4di9v9$8k6@news.bridge.net>
- NNTP-Posting-Host: kitz.intellektik.informatik.th-darmstadt.de
- In-reply-to: David Byrden's message of 17 Jan 1996 07:54:17 GMT
-
- In article <4di9v9$8k6@news.bridge.net> David Byrden <100101.2547@compuserve.com> writes:
-
- >> No, you could do:
-
- >> foo& f( *new foo );
- >> later on:
-
- >> delete &f;
-
-
- Phil, I believe the C++ standards committee have decided to play safe by
- declaring this kind of code as "ill-formed". In other words, a 'perfect'
- C++ compiler need not behave as you want here.
-
- I hope not. IMO such code is reasonable. It takes advantage of the fact,
- that according to DWP 'new' has either to return an object or throw an
- exception. Using a pointer instead of the reference throws away this
- knowledge. Thus the program would need additional nullpointer-checks to
- safely dereference the pointer, which seems tedious to me.
- Anyway how should a compiler detect such situations in a more general
- context ?
-
- Enno
-
-
-